package com.formelo.erupt.model;

import org.hibernate.annotations.GenericGenerator;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.View;

import javax.persistence.*;
import java.util.Date;


@Entity
@Table(
        name = "t_user_info"
)
@Erupt(
        name = "字典项",
        orderBy = "Id",
        power = @Power(
                export = true
        )
)
public class UserTable{
    public UserTable() {
    }

    public Long getId() {
        return Id;
    }

    public void setId(Long id) {
        Id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getCounty() {
        return county;
    }

    public void setCounty(String county) {
        this.county = county;
    }

    //主键
    @Id
    @EruptField(
            views = @View(title = "ID",
                    sortable = true)
    )
    private Long Id;

    //文本输入
//    @EruptField(
//            views = @View(title = "姓名")
//    )
    @EruptField(
            views = {@View(
                    title = "姓名"
            )},
            edit = @Edit(
                    title = "姓名",
                    notNull = true
            )
    )
    private String name;

    //数值输入
    @EruptField(
            views = {@View(
                    title = "年龄"
            )},
            edit = @Edit(
                    title = "年龄",
                    notNull = true
            )
    )
    private Integer age;

//    //布尔选择
//    @EruptField(
//            views = @View(title = "布尔"),
//            edit = @Edit(title = "布尔")
//    )
//    private Boolean bool;

    //文本输入
    @EruptField(
            views = {@View(
                    title = "国家"
            )},
            edit = @Edit(
                    title = "国家",
                    notNull = false
            )
    )
    private String county;

    //时间选择
    @EruptField(
            views = @View(title = "时间")
    )
    private Date date;
}